{extend name="Public:base"/}

{block name="main"}
<div class="box-info">
    <div class="table-toolbar">
        <button class="btn btn-primary" onclick="myform.action='{:U('Category/listorder')}';$('#myform').submit();">排序</button>
        <a href="{:U('Category/add', 'type=0')}" class="btn btn-success">新增系统栏目</a>
        <a href="{:U('Category/add', 'type=1')}" class="btn btn-success">新增单页面</a>
        <a href="{:U('Category/add','type=2')}" class="btn btn-success">新增外链</a>
    </div>

    <div class="row">
        <div class="col-md-12">
            <form name="myform" id="myform" action="{:U('Category/listorder')}" method="post">
                <table class="table table-hover table-condensed table-bordered">
                    <thead>
                    <tr>
                        <th width="80">排序</th>
                        <th width="50">ID</th>
                        <th>栏目名称</th>
                        <th>栏目类型</th>
                        <th>在新窗口打开</th>
                        <th>pc显示</th>
                        <th>wap显示</th>
                        <th>访问</th>
                        <th class="w-300px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>
                            <input name="listorders[{$vo.id}]" value="{$vo.listorder}" class="form-control input-c">
                        </td>
                        <td>{$vo.id}</td>
                        <td>
                            {$vo.title_prefix}{$vo.catname}
                        </td>
                        <td>
                            {switch name="vo['type']"}
                            {case value="1"}
                            单页
                            {/case}
                            {case value="2"}
                            链接
                            {/case}
                            {default /}
                            {$models[$vo['modelid']]['name']}
                            {/switch}
                        </td>
                        <td>
                            {eq name="vo.isblank" value="1"}
                            <i class="fa fa-check text-success"></i>
                            {else/}
                            <i class="fa fa-ban text-danger"></i>
                            {/eq}
                        </td>
                        <td>
                            {eq name="vo.ismenu" value="1"}
                            <i class="fa fa-check text-success"></i>
                            {else/}
                            <i class="fa fa-ban text-danger"></i>
                            {/eq}
                        </td>
                        <td>
                            {eq name="vo.is_wap_menu" value="1"}
                            <i class="fa fa-check text-success"></i>
                            {else/}
                            <i class="fa fa-ban text-danger"></i>
                            {/eq}
                        </td>
                        <td><a href="{$vo.url}" target="_blank">访问</a></td>
                        <td class="w-300px">
                            <?php if ($vo['type'] != 2): ?>
                            <a class="btn btn-success btn-sm" href="{:U('Category/add',array('parentid'=>$vo['id'],'type'=>$vo['type']))}" >添加子栏目</a>
                            <?php endif;?>
                            <a class="btn btn-info btn-sm" href="{:U('Category/edit',array('id'=>$vo['id'],'type'=>$vo['type']))}" >编辑</a>
                            <a class="btn btn-danger btn-sm" href="javascript:confirm_delete('{:U('Category/delete','id='.$vo['id'])}')">删除</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
{/block}